package com.hzqy.web.login;

import java.util.Observable;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 平台ID HW：华为，UT：UT2X: HW3:华为3.0 ZTE：中兴
 * @author dead
 *
 */
public class PartnerIDSession extends ObserverFather {
	private static final Log LOG = LogFactory.getLog(PartnerIDSession.class);
	
	public PartnerIDSession(HttpServletRequest request) {
		super(request);
	}

	@Override
	public void update(Observable o, Object arg) {
		super.update(o, arg);
		String queryString = request.getQueryString();
		String current_partner = (String)session.getAttribute(SessionKey.SESSION_PARTNER);
		if(queryString.indexOf("itvPartner=HUAWEI3") != -1){
			session.setAttribute(SessionKey.SESSION_PARTNER_ID, "HW3");
		} else if(queryString.indexOf("itvPartner=ZX") != -1 
				|| current_partner.indexOf("BST") >= 0 //BST因为是酒店(frame1039)中的epg_info使用了，并且只会出现在中兴平台
				|| current_partner.indexOf("ZTE") >= 0) {
			session.setAttribute(SessionKey.SESSION_PARTNER_ID, "ZTE");
		} else if(queryString.indexOf("itvPartner=UT") != -1 
				|| current_partner.indexOf("UT") >= 0){
				session.setAttribute(SessionKey.SESSION_PARTNER_ID, "UT");
		} else if("HUAWEI_HD30".equals(current_partner)){
			session.setAttribute(SessionKey.SESSION_PARTNER_ID, "hw3");//区分3.0少儿播放跳转
		}else {
			session.setAttribute(SessionKey.SESSION_PARTNER_ID, "HW");
		}
	}

}
